
<div>
  <h1><%= @service_network.new_record? ? "新建服务网点" : "修改服务网点 ##{params[:id]}" %></h1>
</div>

<div class="form-body">
  <%= form_for @service_network,
    url: (@service_network.new_record? ? admin_service_networks_path : admin_service_network_path(@service_network)),
    method: (@service_network.new_record? ? 'post' : 'put'),
    html: { class: 'form-horizontal' } do |f| %>

    <% unless @service_network.errors.blank? %>
      <div class="alert alert-danger">
        <ul class="list-unstyled">
          <% @service_network.errors.messages.values.flatten.each do |error| %>
            <li><i class="fa fa-exclamation-circle"></i> <%= error %></li>
          <% end -%>
        </ul>
      </div>
    <% end -%>

    <div class="form-group">
      <label for="brand" class="col-sm-2 control-label">地区*：</label>
      <div class="col-sm-5">
        <select name="service_network[service_region_id]">
          <% ServiceRegion.all.each do |region| %>
            <option value="<%= region.id %>" <%= 'selected' if @service_network.service_region_id == region.id %>><%= region.name %></option>
          <% end %>
        </select>
      </div>
    </div>

    <div class="form-group">
      <label for="name" class="col-sm-2 control-label">服务网点名*:</label>
      <div class="col-sm-5">
        <%= f.text_field :name, class: "form-control", id: 'name' %>
      </div>
    </div>

    <div class="form-group">
      <label for="name" class="col-sm-2 control-label">电话*:</label>
      <div class="col-sm-5">
        <%= f.text_field :phone, class: "form-control", id: 'phone' %>
      </div>
    </div>

    <div class="form-group">
      <label for="name" class="col-sm-2 control-label">地址*:</label>
      <div class="col-sm-5">
        <%= f.text_field :address, class: "form-control", id: 'address' %>
      </div>
    </div>

    <div class="form-group">
      <div class="col-sm-offset-2 col-sm-8">
        <%= f.submit (@service_network.new_record? ? "新建服务网点" : "编辑服务网点"), class: "btn btn-primary" %>
      </div>
    </div>

  <% end -%>
</div>

